package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduEnrollBack.EduEnrollBackAuditVO;
import com.jwsoft.manager.common.vo.eduEnrollBack.EduEnrollBackKeyVO;
import com.jwsoft.manager.common.vo.eduEnrollBack.EduEnrollBackQueryVO;
import com.jwsoft.manager.common.vo.eduEnrollBack.EduEnrollBackVO;
import com.jwsoft.manager.core.integration.EduEnrollBackIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 退回审核管理网关
 *
 * @author hhj
 * @since 2023-04-04
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "退回审核管理", description = "退回审核管理")
public class EduEnrollBackController {

    @Autowired
    public EduEnrollBackIntegration eduEnrollBackIntegration;

    @Operation(summary = "退回审核管理分页查询",description = "退回审核管理分页查询")
    @PostMapping(value = "/enrollBack0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduEnrollBackVO>> getList(@RequestBody @Validated EduEnrollBackQueryVO vo) {
        return AppResponse.successData(eduEnrollBackIntegration.getList(vo));
    }

    @Operation(summary = "退回审核管理根据主键查询详情",description = "退回审核管理根据主键查询详情")
    @PostMapping(value = "/enrollBack0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduEnrollBackVO> getById(@RequestBody @Validated EduEnrollBackKeyVO vo) {
        return AppResponse.successData(eduEnrollBackIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "退回审核管理新增",description = "退回审核管理新增")
    @PostMapping(value = "/enrollBack0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduEnrollBackVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduEnrollBackVO vo) {
        return AppResponse.successData(eduEnrollBackIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "退回审核管理修改",description = "退回审核管理修改")
    @PostMapping(value = "/enrollBack0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduEnrollBackVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduEnrollBackVO vo) {
        return AppResponse.successData(eduEnrollBackIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "退回审核管理删除",description = "退回审核管理删除")
    @PostMapping(value = "/enrollBack0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduEnrollBackKeyVO vo) {
        eduEnrollBackIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学校退回/退出信息审核",description = "学校退回/退出信息审核")
    @PostMapping(value = "/enrollBack0007", produces = "application/json;charset=UTF-8")
    public AppResponse backAuditEnrollBack(@RequestBody @Validated EduEnrollBackAuditVO vo) {
        eduEnrollBackIntegration.backAuditEnrollBack(vo);
        return AppResponse.successMsg("审核成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "录取退出信息审核(管理员)",description = "录取退出信息审核(管理员)")
    @PostMapping(value = "/enrollBack0008", produces = "application/json;charset=UTF-8")
    public AppResponse returnAuditEnrollBack(@RequestBody @Validated EduEnrollBackAuditVO vo) {
        eduEnrollBackIntegration.returnAuditEnrollBack(vo);
        return AppResponse.successMsg("审核成功！");
    }
}
